import Vue from 'vue';
import Vuex from 'vuex';
import mutations from './mutations';
import actions from './actions';

Vue.use(Vuex);

const state = {
    // 登录状态
    login: false,
    // 比特币数据
    TickerData: {
        btc: {},
        ltc: {},
        eth: {}
    },
    // 加载状态
    loading: false,
}
const getters = {
    getLogin(state) {
        return state.login;  
    },
    getLoading(state) {
        return state.loading;
    },
    getTicker(state) {
        return state.TickerData;
    },
    getBtc: (state, getters) => {
        return state.TickerData.btc;
    },
    getLtc: (state, getters) => {
        return state.TickerData.ltc;
    },
    getEth: (state, getters) => {
        return state.TickerData.eth;
    }
}

export default new Vuex.Store({
    state,
    getters,
    mutations,
    actions,
})